package com.makefuture.controller;

import java.util.ArrayList;
import java.util.List;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.DbPro;
import com.jfinal.plugin.activerecord.Record;

public class ProlemController extends BaseController{

	public void index() {
		String sql = " select * from V_Problem ";
		 List<Record> tb = Db.find(sql);
		 System.out.println(tb.toString());
		 setAttr("plist", tb);
		
		 render("list.jsp");
	}
	/**
	 * 批处理 
	 */
	public void batch() {
		
		List<String> list = new ArrayList<String>();
		for (int i = 0; i <50; i++) {
			String t = "insert into t_user(name) values('"+i+"')";
			list.add(t);
		}
		int[] result = DbPro.use().batch(list, 500);
		System.out.println(list.toString());
//		 Db.batch(sql, 10);
	}
	
}
